package com.threegroup.admin.controller;

import com.github.pagehelper.PageInfo;
import com.threegroup.admin.annotation.AuthorityVerify.AuthorityVerify;
import com.threegroup.admin.dto.AddressBookEntity;
//import com.threegroup.admin.dto.ShoppingCartPageDTO;
import com.threegroup.admin.dto.ShoppingCartPageDTO;
import com.threegroup.admin.entity.ShoppingCartEntity;
import com.threegroup.admin.service.ShoppingCartService;
import com.threegroup.common.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Controller层/api/takeout/shoppingcart
 * 保存save           post
 * 修改update        put
 * 删除delete        delete
 * 导出export       GET
 * 分页page         get
 * 信息{id}         get
 */
@RequestMapping("/takeout/shoppingcart")
@CrossOrigin//跨域
@RestController//返回类型都是json
public class ShoppingCartController {
    @Resource
    private ShoppingCartService shoppingCartService;

    /**
     * 删除
     */
    @DeleteMapping
    public Result delete(@RequestBody Long[] ids){
        return shoppingCartService.delete(ids);
    }

    /**
     * 分页
     */
    @GetMapping("page")
    public Result<PageInfo<ShoppingCartEntity>> page(Integer limit, Integer page, String order, String orderField,String id){
        return shoppingCartService.selectCartList(limit,page,order,orderField,id);
    }
}
